package org.vidi.amqp.common;

import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

/**
 * @author vidi
 */
public class ConnectionUtils {
    public static Connection newSingleConnection() throws IOException, TimeoutException {
        ConnectionFactory factory = new ConnectionFactory();
        factory.setUsername(Constants.USER);
        factory.setPassword(Constants.PASSWORD);
        factory.setHost(Constants.HOST);
        factory.setPort(Constants.PORT);
        return factory.newConnection();
    }
}
